/**
 * Created by Administrator on 2019/5/24 0024.
 */
function hiddenCity(){
    var hiddenView = document.getElementsByClassName("hiddenCity ");
    hiddenView[0].className="hiddenCity hiddenClass";
}
function showCity(){
    var hiddenView = document.getElementsByClassName("hiddenCity ");
    hiddenView[0].className="hiddenCity showClass";
}
function focusSearch(obj){
    obj.value="          "
}
function blurSearch(obj){
    obj.value="          不限量套餐"
}
function selectCity(cityName){
    var changeName = document.getElementsByClassName("cityName");
    changeName[0].innerHTML=cityName;
}


function showInformation_one(){
var showView =document.getElementsByClassName("information_one")[0];
    showView.className="information_one showClass";
}
function hiddenInformation_one(){
    var hiddenView =document.getElementsByClassName("information_one")[0];
   hiddenView.className="information_one hiddenClass";
}
function showInformation_two(){
    var showView =document.getElementsByClassName("information_two")[0];
    showView.className="information_two showClass";
}
function hiddenInformation_two(){
    var hiddenView =document.getElementsByClassName("information_two")[0];
    hiddenView.className="information_two hiddenClass";
}
function showInformation_three(){
    var showView =document.getElementsByClassName("information_three")[0];
    showView.className="information_three showClass";
}
function hiddenInformation_three(){
    var hiddenView =document.getElementsByClassName("information_three")[0];
    hiddenView.className="information_three hiddenClass";
}
var timer_interval;
var  timer_out;
var scroll_height = 0;
var scroll_height_two =0;

timer_interval = setInterval("scroll_img_over()",15);
function start_run(){
    stop_run();
    timer_interval = setInterval("scroll_img_over()",15);
}
function stop_start_run(){
    stop_run();
    timer_out =setTimeout("start_run()",1000)
}

function stop_run(){
    clearInterval(timer_interval);
    clearTimeout(timer_out);
}
function scroll_img_over(){
    var img = document.getElementsByClassName("carousel_img")[0];
    if(scroll_height >= 76){
        scroll_height +=1;
        scroll_height_two -= 4;
        img.scrollTop =scroll_height_two;
        if(scroll_height_two == 0){
            scroll_height = 0;
        }
    }
    else{
        scroll_height_two +=4;
        scroll_height +=  4;
        img.scrollTop = scroll_height;
    }
    if(scroll_height % 76 ==0){
        stop_run();
        timer_out = setTimeout("start_run()",1000);

    }
}
var scroll_height_font =0
var timer_out_font ;
var timer_interval_font =setInterval("scroll_font_over()",50);
function start_run_font(){
    stop_run_font();
    timer_interval_font = setInterval("scroll_font_over()",50);
}
function stop_start_run_font(){
    stop_run_font();
    timer_out_font =setTimeout("start_run_font()",1000)
}

function stop_run_font(){
    clearInterval(timer_interval_font);
    clearTimeout(timer_out_font);
}
function scroll_font_over(){
    var carousel_font = document.getElementsByClassName("carousel_font")[0];
    if( scroll_height_font >= 14*2){
        scroll_height_font = 0;
        carousel_font.scrollTop = scroll_height_font;
    }
    scroll_height_font += 2;
      carousel_font.scrollTop = scroll_height_font;
    if (scroll_height_font % 14 == 0){
        stop_run_font();
        timer_out_font = setTimeout("start_run_font()",2000);
    }
}
function changeProduct(index){
 var con = document.getElementsByClassName("con");
    var txt =document.getElementsByClassName("txt")[0];
    if (index == 0){
        con[0].className="product con clickChange";
        con[1].className="help con";
        txt.value="          不限量套餐";
        txt.onblur="blurSearch(this)";
    }
    if (index == 1){
        con[1].className="help con clickChange";
        con[0].className="product con";
        txt.value="          ";
        txt.onblur="";
    }
}

var content_img_scroll = 0;
var content_img_timerInterval;
content_img_timerInterval = setInterval("main_background_img()",2000);
function main_background_img(){
    var main_img = document.getElementsByClassName("content_img")[0];
    var circle = document.getElementsByClassName("circle");
    if(main_img.scrollTop >=6*425)
    {
        content_img_scroll = 0;
    }

    stop_opaImg();
    content_img_scroll += 425;
    main_img.scrollTop =  content_img_scroll;
    run_opaImg();

    for(var i=0;i<=6;i++){
        if(content_img_scroll /425 ==6){
            circle[0].className="circle circle_onclick";
        }
             if(content_img_scroll /425 ==i){
                 circle[i].className="circle circle_onclick";
                  }
        else{
                 circle[i].className="circle "
             }
    }
}
function run_opaImg(){
    var main_content_img = document.getElementsByClassName("main_content_img")[0];
    main_content_img.style.animation="opaImg 1s linear 0s 1";
}
function stop_opaImg(){
    var main_content_img = document.getElementsByClassName("main_content_img")[0];
    main_content_img.style.animation="";
}
function run_content_img(){
    clearInterval(content_img_timerInterval);
    content_img_timerInterval = setInterval("main_background_img()",2000);
}
function stop_content_img(){
    clearInterval(content_img_timerInterval);
}
function circle_click(obj){
    var content_img = document.getElementsByClassName("content_img")[0];
    var circle = document.getElementsByClassName("circle");
    var main_content_img = document.getElementsByClassName("main_content_img")[0];
    for(var i = 0;i<6 ;i++){
    if(obj == i){
        stop_opaImg();
        content_img_scroll = obj*425;
        content_img.scrollTop =content_img_scroll;
        circle[i].className="circle circle_onclick";
        run_opaImg();
    }
        else{
        circle[i].className="circle ";
    }
    }
}
function main_left_li_mouseOver(obj){
    var main_left_li_over = document.getElementsByClassName("main_left_li_over");
    var main_left_li = document.getElementsByClassName("main_left_li");
    for( var i=0;i < main_left_li_over.length;i++){
        if(i == obj){
            main_left_li[i].className="main_left_li main_left_li_"+i+" ";
        }
    }
}
function main_left_li_mouseOut(obj){
    var main_left_li_over = document.getElementsByClassName("main_left_li_over");
    var main_left_li = document.getElementsByClassName("main_left_li");
    for( var i=0;i < main_left_li_over.length;i++){

        if(i == obj){
            main_left_li[i].className="main_left_li main_left_li_"+i+" hiddenClass ";
        }
    }
}

function main_right_top_mouseOver(obj){
    var main_right_top_change =document.getElementsByClassName("main_right_top_change");
    var main_right_content_change = document.getElementsByClassName("main_right_content_change");
    var main_right_top_i1 =  document.getElementsByClassName("main_right_top_i1")[0];
    var main_right_top_i2 =  document.getElementsByClassName("main_right_top_i2")[0];
    var bgImg = ["images/icon_1.png","images/icon_2.png","images/icon_3.png","images/icon_4.png"];
    var main_right_btn =document.getElementsByClassName("main_right_btn");
    if(obj == 0){
        main_right_top_i1.style.backgroundImage=" url("+bgImg[0]+")";
        main_right_top_i2.style.backgroundImage=" url("+bgImg[3]+")";
        main_right_btn[0].style.display="inline-block";
        main_right_btn[1].style.display="inline-block";
    }
    else{
        main_right_btn[0].style.display="none";
        main_right_btn[1].style.display="none";
        main_right_top_i1.style.backgroundImage=" url("+bgImg[1]+")";
        main_right_top_i2.style.backgroundImage=" url("+bgImg[2]+")";
    }
    for (var i = 0 ;i < main_right_top_change.length;i++){
         if(obj == i){

                main_right_content_change[obj].className="main_right_content_change";
                main_right_top_change[obj].style.color="#FF8201";
       }
        else{

        main_right_content_change[i].className="main_right_content_change hiddenClass";
        main_right_top_change[i].style.color="#717171";
    }

    }
}
function main_right_content_two_select(obj){
    var select = document.getElementsByClassName("select");
    var  main_right_content_four_li2 = document.getElementsByClassName("main_right_content_four_li2")[0];
    var  main_right_content_four_li1 = document.getElementsByClassName("main_right_content_four_li1");
    for (var i = 0;i<select.length;i++){
        if (obj == i){
            select[obj].style.color="#FF8201";
        }
        else{
            select[i].style.color="#777777";
        }
        if(obj==1){
            main_right_content_four_li2.className="main_right_content_four_li2 hiddenClass";
        }
        else{
            main_right_content_four_li2.className="main_right_content_four_li2 ";
        }
        if(obj==3){
            main_right_content_four_li1[0].className="main_right_content_four_li1 hiddenClass"
            main_right_content_four_li1[1].className="main_right_content_four_li1 "
        }
        else{
            main_right_content_four_li1[0].className="main_right_content_four_li1 "
            main_right_content_four_li1[1].className="main_right_content_four_li1 hiddenClass"
        }
    }
}
var scroll_li_width = 0;
var scroll_li_timer_interval = setInterval("main_right_content_six_li_carousel()",20);

function main_right_content_six_li_carousel(){
    var li_carousel = document.getElementsByClassName("li_carousel")[0];
    if (scroll_li_width >= 2400){
        scroll_li_width =0;
        li_carousel.scrollLeft=scroll_li_width;
    }
        scroll_li_width += 1;
        li_carousel.scrollLeft=scroll_li_width;
}
function run_scroll_li_timer_interval(){
    clearInterval(scroll_li_timer_interval);
    scroll_li_timer_interval = setInterval("main_right_content_six_li_carousel()",20);
}
function stop_scroll_li_timer_interval(){
    clearInterval(scroll_li_timer_interval);
}



var main_right_content_scroll =0;
var main_right_content_timer;

function left_btn(){
 var main_right_content_one_all = document.getElementsByClassName("main_right_content_one_all")[0];
if(main_right_content_scroll <= 0 ){
    main_right_content_scroll = 2 * 186;
}
    main_right_content_scroll -= 6;
    main_right_content_one_all.scrollLeft= main_right_content_scroll;
    if (main_right_content_scroll % 186 != 0){

        clearInterval(main_right_content_timer);
        main_right_content_timer = setTimeout("left_btn()",10)
    }

}
function right_btn(){
    var main_right_content_one_all = document.getElementsByClassName("main_right_content_one_all")[0];
    if(main_right_content_scroll >= 2 * 186 ){
        main_right_content_scroll =0;
    }
    main_right_content_scroll += 6;
    main_right_content_one_all.scrollLeft= main_right_content_scroll;
    if (main_right_content_scroll % 186 != 0){
        clearInterval(main_right_content_timer);
        main_right_content_timer = setTimeout("right_btn()",10)
    }
}
var recharge_height =0 ;
var recharge_timer;
function recharge_over (){
    var recharge =document.getElementsByClassName("recharge")[0];
    recharge.className ="recharge";
    if(recharge_height != 125){
        recharge_height += 1;
        recharge.style.height=""+recharge_height+"px";
        recharge_timer =setTimeout("recharge_over()",5)
    }
    else if(recharge_height == 125){
        recharge_height=0;
    }
}
function recharge_out(){
    var recharge =document.getElementsByClassName("recharge")[0];
    recharge.className ="recharge hiddenClass";
}
function recharge_over_one(){
    var recharge =document.getElementsByClassName("recharge")[0];
    recharge.className ="recharge";
}
function recharge_click(obj){
   var recharge_input = document.getElementsByClassName("recharge_input")[0];
    var recharge_click_select =document.getElementsByClassName("recharge_click_select");
    recharge_input.value=  recharge_click_select[obj].innerHTML;
}


var foot_one_timer;
foot_one_timer=  setInterval("foot_one_right_btn()",2000);
var foot_one_leftScroll=0;
var foot_one_timeOut;
function foot_one_run (){
    clearTimeout(foot_one_timeOut);
    clearInterval(foot_one_timer);
    foot_one_timer=  setInterval("foot_one_right_btn()",2000);
}
function foot_one_stop () {
    clearInterval(foot_one_timer);
    clearTimeout(foot_one_timeOut);
}

function  foot_one_right_btn(){
    var foot_one_right = document.getElementsByClassName("foot_one_right")[0];
if(foot_one_leftScroll >= 2 *1004 ){
    foot_one_leftScroll = 0;
}
    foot_one_leftScroll += 1004;
    foot_one_right.scrollLeft = foot_one_leftScroll;
    if(foot_one_leftScroll % 1004 == 0){
        clearTimeout(foot_one_timeOut);
        clearInterval(foot_one_timer);
        foot_one_timeOut = setTimeout("foot_one_run()",2000)
    }

}
function  foot_one_left_btn(){
    var foot_one_right = document.getElementsByClassName("foot_one_right")[0];
    if(foot_one_leftScroll <= 0 ){
        foot_one_leftScroll = 2 *1004;
    }
    foot_one_leftScroll -= 1004;
    foot_one_right.scrollLeft = foot_one_leftScroll;
    if(foot_one_leftScroll % 1004 == 0){
        clearTimeout(foot_one_timeOut);
        clearInterval(foot_one_timer);
        foot_one_timeOut = setTimeout("foot_one_run()",2000)
    }

}

function foot_ten_onclick(obj){
    var foot_ten_change = document.getElementsByClassName("foot_ten_change");
    var foot_ten_bold = document.getElementsByClassName("foot_ten_bold");
    if (obj == 0){
        foot_ten_change[0].className ="foot_ten_change";
        foot_ten_bold[0].style.fontWeight="bolder";
        foot_ten_change[1].className ="foot_ten_change hiddenClass";
        foot_ten_bold[1].style.fontWeight="normal";
    }
    else {
        foot_ten_change[0].className ="foot_ten_change hiddenClass";
        foot_ten_bold[0].style.fontWeight="normal";
        foot_ten_change[1].className ="foot_ten_change";
        foot_ten_bold[1].style.fontWeight="bolder";
    }

}

function foot_ten_imgClick(obj) {
    var foot_ten_top_hidden_li = document.getElementsByClassName("foot_ten_top_hidden_li")[0];
    var foot_ten_top_two_img =document.getElementsByClassName("foot_ten_top_two_img");
    for(var i =0;i<2;i++){
        if( i== obj){

            foot_ten_top_two_img[i].className ="foot_ten_top_two_img hiddenClass ";
        }
        else{

            foot_ten_top_two_img[i].className ="foot_ten_top_two_img ";
        }
        if (obj == 0){
            foot_ten_top_hidden_li.className ="foot_ten_top_hidden_li";
        }
        else{
            foot_ten_top_hidden_li.className ="foot_ten_top_hidden_li hiddenClass";
        }
    }
}






var foot_two_timer;
foot_two_timer=  setInterval("foot_two_right_btn()",1000);
var foot_two_leftScroll=0;
var foot_two_timeOut;
function foot_two_run (){
    clearTimeout(foot_two_timeOut);
    clearInterval(foot_two_timer);
    foot_two_timer=  setInterval("foot_two_right_btn()",1000);
}
function foot_two_stop () {
    clearTimeout(foot_two_timeOut);
    clearInterval(foot_two_timer);
}

function  foot_two_right_btn(){
    var foot_two_image = document.getElementsByClassName("foot_two_image")[0];
    if(foot_two_leftScroll >= 3 * 403 ){
        foot_two_leftScroll = 0;
    }
    foot_two_leftScroll += 403;
    foot_two_image.scrollLeft = foot_two_leftScroll;
    if(foot_two_leftScroll % 403 == 0){
        clearTimeout(foot_two_timeOut);
        clearInterval(foot_two_timer);
        foot_two_timeOut = setTimeout("foot_two_run()",1000)
    }

}

function  foot_two_left_btn(){
    var foot_two_image = document.getElementsByClassName("foot_two_image")[0];
    if(foot_two_leftScroll <=  0){
        foot_two_leftScroll = 3 * 403;
    }
    foot_two_leftScroll -= 403;
    foot_two_image.scrollLeft = foot_two_leftScroll;
    if(foot_two_leftScroll % 403 == 0){
        clearTimeout(foot_two_timeOut);
        clearInterval(foot_two_timer);
        foot_two_timeOut = setTimeout("foot_two_run()",1000)
    }

}

var advertisement_timeOut;

var advertisement_topHeight = 0;
function img_runUp(){
    var advertisement = document.getElementsByClassName("advertisement")[0];
    advertisement_topHeight += 1;
    advertisement.style.bottom=""+advertisement_topHeight+"px";
    if(advertisement_topHeight != 400){
        clearTimeout(advertisement_timeOut);
        advertisement_timeOut =setTimeout("img_runUp()",10)
    }
}